package com.xpc.config;

import com.xpc.pojo.Position;
import com.xpc.service.IPositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import java.util.HashMap;
import java.util.List;

/**
 * @author Qinkuer
 * @version 1.0.0
 * @ProjectName UniversityGradeAdministrationSystem
 * @ClassName PositionConfig.java
 * @Description TODO 暂时没用
 * @createTime 2022年05月27日 01:11:00
 */
@Configuration
public class PositionConfig {
    @Autowired
    private IPositionService iPositionService;

    @Bean(name="positionHashMap")
    @Scope(value = "prototype")
    public HashMap<Integer  ,String> positionHashMap(){
        HashMap<Integer, String> integerStringHashMap = new HashMap<>();
        List<Position> list = iPositionService.list();
        for (Position p:list){
            integerStringHashMap.put(p.getId(),p.getName());
        }
        return integerStringHashMap;
    }

}
